//
//  GLHTTPTool.h
//  SXBPurchase
//
//  Created by huanggulong on 2017/10/8.
//  Copyright © 2017年 历山大亚. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface GLHTTPTool : NSObject

/**
 *  发送一个POST请求
 *
 *  @param url     请求路径
 *  @param params  请求参数
 *  @param success 请求成功后的回调
 *  @param failure 请求失败后的回调
 */
+ (NSURLSessionDataTask *)postWithURL:(NSString *)url params:(NSDictionary *)params success:(void (^)(id json))success failure:(void (^)(NSError *error))failure;

+ (NSURLSessionDataTask*)getWithURL:(NSString *)url params:(NSDictionary *)params success:(void (^)(id json))success failure:(void (^)(NSError *error))failure;

+(NSURLSessionDataTask *)jsonWithURL:(NSString *)url params:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSError *))failure;
/*
 * @huanggulong
 *
 * 上传文件 使用post
 */
+(void)uploadPostWithURL:(NSString *)url fileUrl:(NSData *)fileData andParam:(NSDictionary *)params  completion:(void (^)(id json))complete progress:(NSProgress *)progress failure:(void (^)(NSError *))failure;

+(void)setLoginToken:(NSString *)loginToken;

@end
